#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long LL;
LL gcd(LL a, LL b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
LL gcds(LL a[], LL n)
{
    LL ans = a[0], i;
    for (i = 1; i < n; i++)
    {
        ans = gcd(ans, a[i]);
    }
    return ans;
}
int main()
{
    LL n, i, g;
    cin >> n;
    LL a[n];
    for (i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    g = gcds(a, n);
    cout << g << endl;
    return 0;
}